home *** CD-ROM | disk | FTP | other *** search
- Path: news.logicon.com!newsmaster@klee
- From: kkolda@logicon.com (Kenneth D. Kolda)
- Newsgroups: comp.lang.c++
- Subject: Re: "Pure virtual function called" error with Sparcworks
- Date: 11 Apr 1996 20:52:03 GMT
- Organization: Logicon Operating Systems
- Message-ID: <4kjrdj$fhi@piper.logicon.com>
- References: <316B8607.41C67EA6@jpmorgan.com>
- NNTP-Posting-Host: 137.51.122.161
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.99.2
-
- In article <316B8607.41C67EA6@jpmorgan.com>, peck_oliver@jpmorgan.com
- says...
- >
- >I am using V4.0.1 of the Sparcworks C++ compiler.
- >
- >A program is occasionally crashing with the message:-
- >
- >"**** Pure virtual function called"
- >
- >Does anyone know what this may mean?
- >
- >
- >Thanks in advance.
- >
- >Oliver
-
-
- I suspect this is caused by the fact that you're calling a pure virtual
- function in a base class constructor. For example, if you have
-
- class A {
- public:
- A() { Foo(); };
- virtual void Foo() = 0;
- };
-
- class B : public A {
- public:
- B() {};
- void Foo() {};
- };
-
-
- main()
- {
- B b;
- }
-
-
- Try this out. In Sparkworks C++ this should give you the
- "****Pure virtual function called" error and core dump. According to the
- C++ standards, calling a pure virtual function from a base class
- constructor has undefined results.
-
- Ken Kolda
-
-